﻿@using Bifrost.Web.Mvc.Commands
@using Bifrost.Samples.Blog.Mvc.Features.Blogs;
@using Bifrost.Samples.Blog.Domain.Blogs.Commands;
@using Bifrost.Samples.Blog.Views.Blogs;
@using BlogEntity = Bifrost.Samples.Blog.Views.Blogs.Blog;
@model IEnumerable<BlogEntity>
@{
	ViewBag.Title = "Blog List";
}
<ul>
	@foreach (var blog in Model)
	{
		<li>
            @Html.ActionLink(blog.Name, "List", "Posts", new { blogId = blog.Id }, null)
		</li>
	}
</ul>
@using (var form = Html.BeginCommandForm<CreateBlog, BlogsController>(c => c.Create(null), FormMethod.Post))
{
	@form.Html.HiddenFor(c => c.Id);
    <ul>
        <li>
            @form.Html.LabelFor(c => c.Name)
            @form.Html.TextBoxFor(c => c.Name)
            @form.Html.ValidationMessageFor(c => c.Name)
        </li>
        <li>
            @form.Html.LabelFor(c => c.TagLine)
            @form.Html.TextBoxFor(c => c.TagLine)
            @form.Html.ValidationMessageFor(c => c.TagLine)
        </li>
        <li>
            @form.Html.LabelFor(c => c.Owner)
            @form.Html.TextBoxFor(c => c.Owner)
            @form.Html.ValidationMessageFor(c => c.Owner)
        </li>
    </ul>
	<input type="submit" value="Create" />
} 